//
//  QianDTableCell.m
//  Estate
//
//  Created by heyong on 16/5/31.
//  Copyright © 2016年 ttsx. All rights reserved.
//

#import "QianDTableCell.h"

@implementation QianDTableCell
- (void)setIsedit:(BOOL)isedit{
    if(isedit){
        self.textField.userInteractionEnabled=YES;
    }else{
        self.textField.userInteractionEnabled=NO;
    }
}

- (void)awakeFromNib {
    [super awakeFromNib];
    self.title.font=[UIFont systemFontOfSize:16*BIZ];
    self.textField.font=[UIFont systemFontOfSize:16*BIZ];
    self.selectionStyle=UITableViewCellSelectionStyleNone;
    self.title.textColor=UIColorFromRGB(0x797979);
    self.textField.delegate=self;

    
    self.textField.textColor=[UIColor colorWithRed:0.57 green:0.57 blue:0.57 alpha:1.00];
}

- (IBAction)editDidBegin:(ESTextField *)sender {
    if(self.editDidBeginBlock) {
        self.editDidBeginBlock(sender);
    }
}

- (IBAction)TextChange:(UITextField *)sender {
    if (self.textValueChangedBlock) {
        self.textValueChangedBlock(self.textField.text);
    }
}

- (IBAction)editDidEnd:(UITextField *)sender {
    if (self.editDidEndBlock) {
        self.editDidEndBlock(self.textField.text);
    }
}

- (void)setColor:(UIColor *)color{
    _title.textColor = color;
}

- (void)configWithPlaceholder:(NSString *)phStr andValue:(NSString *)valueStr andLabel:(NSString*)label andKeyType:(UIKeyboardType) kt{
    self.title.text=label;
    self.textField.placeholder=phStr;
    self.textField.text=valueStr;
    self.textField.keyboardType=kt;
    self.textField.returnKeyType=UIReturnKeyDone;
}

- (void)configWithPlaceholder:(NSString *)phStr andValue:(NSString *)valueStr andLabel:(NSString*)label andKeyType:(UIKeyboardType) kt isShpw:(BOOL)isShow andFontSize:(CGFloat)f{
    self.title.text=label;
    self.textField.placeholder=phStr;
    self.textField.text=valueStr;
    self.textField.keyboardType=kt;
    self.textField.secureTextEntry=isShow;
    self.title.font=[UIFont systemFontOfSize:f*BIZ];
    self.textField.font=[UIFont systemFontOfSize:f*BIZ];
    
    self.textField.returnKeyType=UIReturnKeyDone;

}

//设置分割线
- (void)drawRect:(CGRect)rect
{
    CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetFillColorWithColor(context, [UIColor clearColor].CGColor); CGContextFillRect(context, rect);
    //    //上分割线，
    //    CGContextSetStrokeColorWithColor(context, [UIColor grayColor].CGColor); CGContextStrokeRect(context, CGRectMake(0, -1, rect.size.width , 1));
    //下分割线
    CGContextSetStrokeColorWithColor(context,[UIColor colorWithRed:0.89 green:0.89 blue:0.90 alpha:1.00].CGColor); CGContextStrokeRect(context, CGRectMake(0, rect.size.height, rect.size.width, 1));
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the vi3ew for the selected state
}

#pragma mark--UITextFiledDelegate
-(BOOL)textFieldShouldReturn:(UITextField *)textField{
    [textField resignFirstResponder];
    return YES;
}



@end



